package com.huluobo.a2206parkdemo.parking

import android.content.Intent
import android.graphics.BitmapFactory
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.google.vr.sdk.widgets.pano.VrPanoramaView
import com.huluobo.a2206parkdemo.R
import com.huluobo.a2206parkdemo.databinding.ActivityParkingVrBinding
import com.huluobo.base.bean.ParkingBeanItem
import com.huluobo.base.mvvm.BaseActivity
import com.huluobo.base.net.Const
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class ParkingVRActivity : BaseActivity<ActivityParkingVrBinding, ParkingViewModel>() {
    private lateinit var parkingBeanItem: ParkingBeanItem
    override fun initData() {
    }

    override fun initView() {
        binding.parkingVrHeader.headerTitle.text = "车位预览"
        binding.parkingVrHeader.headerAdd.visibility = View.VISIBLE
        parkingBeanItem = intent.getSerializableExtra(Const.PARAM_PARKING_BEAN) as ParkingBeanItem
        binding.parkingVrHeader.headerAdd.setOnClickListener {
            val intent = Intent(this, AddParkingActivity::class.java)
            intent.putExtra(Const.PARAM_PARKING_BEAN, parkingBeanItem)
            startActivity(intent)
            finish()
        }

        binding.parkingVrHeader.headerBack.setOnClickListener { finish() }

        val option = VrPanoramaView.Options()
        option.inputType = VrPanoramaView.Options.TYPE_MONO //设置水平轴360旋转
        binding.vrView.loadImageFromBitmap(BitmapFactory.decodeResource(resources, R.drawable.ccc), option)

    }
}